The present invention relates to a communication system for transmitting a message or data using a communication packet and, more particularly, to a communication device having a lock function of responding to only the communication packet sent from a specific communication device and a communication system using it.
As a communication system including such a communication, a domestic digital bus (D2B) which is a data bus between household audio/video devices has been proposed. Also, an example of the patent which relates to such communication system is a European Patent Application No. EP 0333269.
An arrangement of the D2B communication system including a plurality of communication devices is shown in FIG. 1. Specifically, in FIG. 1, the communication system is composed of a transmission or transfer path 70 and a plurality of communication devices 71a, 71b, 71c . . . connected with the transmission path 70. In tile D2B communication system, each of the communication devices 71a, 71b, 71c . . . has a function serving as a master device capable of independently executing a communication (that is, "a multi-master function"). The communication device as a master will send out a communication packet described below to the transmission path 70. Another device which has been designated as a communication partner by the communication packet will serve as a slave receiving this communication packet.
The format of the communication packet used in the D2B communication system is shown in FIG. 2. As shown in FIG. 2, the communication packet is composed of a header 80, a master address field 81, a slave address field 82, a control field 83 and a data field 84.
The header 80 is composed of start bits 85 indicative of sending a communication packet and mode bits 86 indicative of either one of three kinds of modes (modes 0, 1 and 2) with different transfer speeds. The master address field 81 is composed of master address bits 87 indicative of the address of the communication device serving as a master and a parity bit 88. The slave address field 82 is composed of slave address bits 89 indicative of the address of a slave communication device which is a communication partner of the master communication device, a parity bit 90 and an acknowledge bit 91 for acknowledging right reception of the communication packet by the slave communication device. The control field 83 is composed of control bits 92 described below, a parity bit 93, and an acknowledge bit 94. In this case, the control bits 92 are a control code indicative of the transfer direction and contents of communication data, and lock setting or lock releasing. For example, the control bits of requesting data write in a slave communication device and setting lock is referred to as "Bh", that of requesting data write and releasing lock is referred to as "Fh", and that of requesting reading the status from the slave communication device is referred to as "6h".
The data field 84 is composed of repetition of basic unit data 99 which includes 1 (one) byte data bits 95, an end-of-data bit 96 indicative of an end of the communication data, a parity bit 97 and an acknowledge bit 98. A message will be transferred acknowledging that it has been received by a receiving communication device for each one byte data based on the basic unit data 99. If the one byte data have not been received and hence the acknowledge bit has not been sent back, the same one byte data will be transferred again. The maximum number of times of repetition of the basic data unit 99 is determined in accordance with the communication mode (mode 0, 1, or 2) defined by the mode bits 86. For example, it is 32 in the case of mode 1. Therefore, in the case of mode 1, the data up to 32 bytes can be transferred using one communication packet.
An explanation will be given of the method for transferring a message from a master communication device to a slave communication device. In the D2B communication system, the message over a plurality of communication packets will be transferred to the slave communication device in a manner of locking the slave communication device. Locking the slave communication device will be performed using the control bits 92 of requesting locking in the case where the communication packet the acknowledge bit of which has been sent back owing to successful transfer of at least one byte data within the data field 84 has been exchanged between the master communication device and the slave communication device concerned. Thereafter, until the locking is released, the locked slave communication device will not receive or accept a communication packet sent from any communication device other than the master communication device having locked the slave communication device concerned. On the other hand, releasing the locking (hereinafter referred to as "unlocking") of the slave communication device will be performed using the control bits 92 of requesting unlocking in the case where the communication packet the acknowledge bit of which has been sent back owing to successful transfer of at least one byte data within the data field 84 has been exchanged between the master communication device and the slave communication device concerned.
FIG. 3 shows a combination of communication packets in transferring a message of 40 bytes in communication mode 1 from the communication device 71a as a master in FIG. 1 to the communication device 71b as a slave. It should be noted that in the communication as shown in FIG. 3, three communication packets are transferred from the communication device 71a to the communication device 71b.
The first transferring method will be explained.
In the first communication packet 100, the control bits 92 are set for "Bh" (data write and locking) to request locking and transfer 32 byte data which can be transferred in mode 1. Now, it is assumed that the 32 byte data have been transferred satisfactorily. Since this means that the data of one byte or more have been transferred satisfactorily, the slave communication device 71b will be locked by the master communication device 71a.
In the second communication packet 101 also, the control bits 92 are set for "Bh" (data write and locking) to request locking and transfer the remaining 8 byte data to be added to the 32 byte data which have already been transferred using the first communication packet 100. In this case, since the communication device 71b has already been locked, it remains locked regardless of the communication result, i.e., whether the remaining 8 byte data have been completely transferred or even one byte data has not been transferred. Now it should be noted that the second communication packet 101 does not set the control bits 92 for "Fh" (data write and unlocking) which is a code requesting release of locking. This is because it is not guaranteed that the second communication packet can surely transfer the remaining 8 byte data. Although not shown in FIG. 1, for example, if the communication device 71b has a buffer area for data reception of only one byte and is late to read out the received data from the buffer, the second communication packet 101 may be able to transfer only one byte corresponding to the size of the buffer. In this case, although 7 bytes to be transferred remain, the communication device 71b will be unlocked.
In the third communication packet 102, the control bits 92 are set for "6h" (read of slave status and unlocking) to read one byte slave status from the slave communication device 71b. When the slave status has been successfully read out, the communication device 71b will be unlocked.
Another transfer method will be explained below. As the first communication packet has the same format as in the above first transfer method, the same explanation is not repeated here. In the second communication packet 103, the control bits 92 are set for "Bh" to request locking and transfer 7 byte data which is lesser by one byte than the remainder (8 bytes) of the message to be added to the 32 byte data transferred using the first communication packet 100. In the last third communication packet 104, the control bits 92 are set for "Fh" (data write and unlocking) to request unlocking and transfer the remaining one byte data. When this last one byte data has been successfully transferred, tile communication device 71b will be unlocked.
In this way, by locking the communication device serving as a slave, the communication device serving as a master can transfer data to the slave communication device without being disturbed by other communication devices. Further, since the slave communication device does not accept or receive the communication packet from any communication device other than a specific communication device, communication data over a number of communication packets can be formed as one message.
However, the communication system has the following disadvantage. In order to surely transfer data from a master communication device to a slave communication device, one communication packet is required for the purpose of locking/unlocking so that one redundant communication packet must be transferred. For example, in order to transfer 40 byte data which can be transferred using two communication packets in the mode 1, at least three communication packets are required. This makes the transfer efficiency inferior. Further, since the values of the control bits set for locking and unlocking are different, the master communication device must construct the communication packets by taking into account the locking of the slave communication device, thus making the processing required complicate.